﻿Public Class Site1
    Inherits System.Web.UI.MasterPage

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If (HttpContext.Current.User.Identity.Name <> Nothing) Then
            Dim contentPages As String = ""

            contentPages = contentPages + "<li><a href=""../../ProfileManager.aspx"">My Profile</a></li>"
            contentPages = contentPages + "<li><a href=""../../RegisteredMembers.aspx"">Members</a></li>"
            contentPages = contentPages + "<li><a href=""../../rssList.aspx"">RSS</a></li>"
            contentPages = contentPages + "<li><a href=""../../AdvancedSearch.aspx"">Search</a></li>"

            If ((HttpContext.Current.User.IsInRole("Teacher")) And (Not HttpContext.Current.User.IsInRole("Admin"))) Then
                contentPages = contentPages + "<li><a href=""../../RequestPromotion.aspx"">Promotion</a></li>"
            End If

            If ((Not HttpContext.Current.User.IsInRole("Teacher")) And (Not HttpContext.Current.User.IsInRole("Admin"))) Then
                contentPages = contentPages + "<li><a href=""../../RequestPromotion.aspx"">Promotion</a></li>"
            End If

            If (HttpContext.Current.User.IsInRole("Admin")) Then

                contentPages = contentPages + "<li><a href=""../../Admin/BlockUser.aspx"">Block</a></li>"
                contentPages = contentPages + "<li><a href=""../../Admin/EditComments.aspx""> Comments</a></li>"
                contentPages = contentPages + "<li><a href=""../../Admin/EditRankingPoints.aspx""> Points</a></li>"
                contentPages = contentPages + "<li><a href=""../../Admin/Graphs.aspx""> Graphs </a></li>"
                contentPages = contentPages + "<li><a href=""../../Admin/ApprovePromotion.aspx"">Rank</a></li>"
                contentPages = contentPages + "<li><a href=""../../Admin/EditTags.aspx"">Tags</a></li>"

            End If

            If (HttpContext.Current.User.IsInRole("Teacher")) Then

                contentPages = contentPages + "<li><a href=""../../Teachers/AddQuiz.aspx""> Add Quiz </a></li>"
                contentPages = contentPages + "<li><a href=""../../Teachers/EditQuiz.aspx""> Edit Quiz </a></li>"

            End If


            contentPages = contentPages + "<li><a href=""../../Account/Logout.aspx""> Logout </a></li>"
            ltrTopMenu.Text = contentPages
        Else
            Dim contentPages As String = ""
            contentPages = contentPages + "<li><a href=""../../Account/Login.aspx""> Login </a></li>"
            contentPages = contentPages + "<li><a href=""../../Account/Register.aspx""> Register </a></li>"

            ltrTopMenu.Text = contentPages
        End If



    End Sub

End Class